#include "consumerthread.h"
#include <QDebug>

ConsumerThread::ConsumerThread(QObject *parent) 
    : QThread(parent), m_stopped(false)
{
}

void ConsumerThread::stop()
{
    QMutexLocker locker(&m_mutex);
    m_stopped = true;
}

void ConsumerThread::handleData(int value)
{
    // 处理数据并发射结果信号
    QString result = QString("处理后的数据: %1").arg(value * 2);
    emit resultReady(result);
}

void ConsumerThread::run()
{
    // 消费者线程的事件循环
    exec();
}
